home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
libs
/
newlooklib.lha
/
newlook
/
createborder.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-24
|
2KB
|
70 lines
/*
* CREATEBORDER.C
*/
#include "newlook.h"
struct Border *CreateBorder(x,y,w,h,pn)
SHORT x,y,w,h;
BOOL pn; /* FALSE=positive, TRUE=negative */
{
struct Border *tl, *br; /* TopLeft, BottomRight */
SHORT *xy;
ULONG UserHandle= SetNewLookHandle(PRIVATE_HANDLE);
if(tl= (struct Border *)SmartAllocate(BORDERSIZE))
{
if(br= (struct Border *)SmartAllocate(BORDERSIZE))
{
if(xy= (SHORT *)SmartAllocate(2*BORDERXYSIZE))
{
--w;
--h;
/* shining edges */
xy[0]= w-1; xy[1]= 0; /* ++++++++++++ */
xy[2]= 0; xy[3]= 0; /* ++ */
xy[4]= 0; xy[5]= h; /* ++ */
xy[6]= 1; xy[7]= h-1; /* ++ */
xy[8]= 1; xy[9]= 1; /* + */
/* shadow edges */
xy[10]= 1; xy[11]= h; /* + */
xy[12]= w; xy[13]= h; /* ++ */
xy[14]= w; xy[15]= 0; /* ++ */
xy[16]= w-1; xy[17]= 1; /* ++ */
xy[18]= w-1; xy[19]= h-1; /* ++++++++++++ */
/* top, left (shining) border */
tl->LeftEdge = x;
tl->TopEdge = y;
tl->FrontPen = pn ? 1:2;
tl->BackPen = 0;
tl->DrawMode = JAM1;
tl->Count = 5;
tl->XY = &xy[0];
tl->NextBorder = br;
/* bottom, right (shadow) border */
br->LeftEdge = x;
br->TopEdge = y;
br->FrontPen = pn ? 2:1;
br->BackPen = 0;
br->DrawMode = JAM1;
br->Count = 5;
br->XY = &xy[10];
br->NextBorder = (struct Border *)NULL;
MakePrivateHandlePublic(UserHandle);
return(tl);
}
}
}
if(UserHandle != PRIVATE_HANDLE)
{ SmartFreeAll(PRIVATE_HANDLE);
(void)SetNewLookHandle(UserHandle);
}
return (struct Border *)NULL;
}